"""
author: MaoJiu0916
date: 2022-03-14
"""

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

if __name__ == '__main__':
    username = "111111111"  # 统一身份认证的学号
    password = "************"  # 统一身份认证的密码
    url = "https://student.hitsz.edu.cn/xg_mobile/loginChange"

    option = webdriver.EdgeOptions()
    option.add_argument('window-size=1920x3000')  # 指定浏览器分辨率
    option.add_argument('--disable-gpu')
    option.add_argument('--hide-scrollbars')  # 隐藏滚动条, 应对一些特殊页面
    web = webdriver.Edge(options=option)
    web.maximize_window()

    web.get(url)
    web.find_element(By.CLASS_NAME, "ty_btn").click()
    web.implicitly_wait(30)
    web.find_element(By.CLASS_NAME, "login_box_inputuser").send_keys(username)
    web.find_element(By.CLASS_NAME, "login_box_inputpassword").send_keys(password)
    web.implicitly_wait(30)
    web.find_element(By.CLASS_NAME, "login_box_landing_btn").click()
    web.implicitly_wait(30)
    web.find_element(By.CLASS_NAME, "part_action_left").click()
    web.find_element(By.ID, "dtjwd").click()
    time.sleep(3)
    commit1 = web.find_element(By.XPATH, "/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div[62]/label")
    webdriver.ActionChains(web).move_to_element(commit1).click(commit1).perform()
    time.sleep(1)
    web.find_element(By.XPATH, "/html/body/div[2]/div[2]/div[2]/div/div/div[1]/div[63]/div/div").click()
    web.quit()

    print("Report Successfully!")
